#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 1e4+10;
int dp[maxn];
int vis[30];
char s[maxn];
struct node
{
	char s[30];
}ans[maxn];
bool cmp(node a,node b)
{
	return strcmp(a.s,b.s)<0;
}
int main()
{

	while(scanf("%s",s)!=EOF)
	{
		int len = strlen(s);
		memset(vis,-1,sizeof(vis));
		memset(dp,0,sizeof(dp));
		vis[s[0]-'a'] = 0;
		dp[0] = 1;
		int l,maxl;
		l = 0;
		maxl = 1;
		for(int i = 1;i<len;i++)
		{
			if(vis[s[i]-'a']==-1)
			{
				dp[i] = dp[i-1]+1;
				vis[s[i]-'a'] = i;
			}
			else 
			{
				if(l<=vis[s[i]-'a'])
				{
					dp[i] = i-vis[s[i]-'a'];
					l = vis[s[i]-'a']+1;
					vis[s[i]-'a'] = i;
				}
				else dp[i] = dp[i-1]+1,vis[s[i]-'a']=i;
			}
			if(dp[i]>maxl) maxl = dp[i];
		}
		int cnt = 0;
		for(int i = 0;i<len;i++)
		{
			if(dp[i]==maxl)
			{
				for(int j=0;j<maxl;j++)
				{
					ans[cnt].s[j] = s[i-maxl+j+1];
				}
				ans[cnt].s[maxl] = '\0';
				cnt++;
			}
		}
		sort(ans,ans+cnt,cmp);
		printf("%d\n",maxl);
		puts(ans[0].s);
		for(int i = 1;i<cnt;i++)
		{
			if(strcmp(ans[i].s,ans[i-1].s)==0) continue;
			puts(ans[i].s);
		}
	}
}
